package com.example.qt.ptplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qt.ptplatform.entity.FavoriteTorrent;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FavoriteTorrentMapper extends BaseMapper<FavoriteTorrent> {

    @Select("SELECT COUNT(*) FROM favorite_torrents WHERE user_id = #{userId} AND torrent_id = #{torrentId}")
    int existsByUserIdAndTorrentId(@Param("userId") Integer userId, @Param("torrentId") Integer torrentId);

}